Skip to content

Conversation

@GaoSSR
Copy link
Contributor

@GaoSSR GaoSSR commented Dec 31, 2025

Fixes #10324

enhanced.append("Failed to collect dependencies");

org.eclipse.aether.graph.Dependency root = request.getRoot();
if (root != null && root.getArtifact() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (root != null && root.getArtifact() != null) {
return if (root != null && root.getArtifact() != null) ? enhanceDependency() : enhanceDependencies(...);

could be extracted as dedicated branch/concern to provide cohesion over coupling.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ternary operators are harder to read

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when correctly formatted its actually just like code structure below: just with different character.

Image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

}
}

for (org.eclipse.aether.graph.Dependency dep : request.getDependencies()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be extracted as dedicated branch/concern to provide cohesion over coupling.

Suggested change
for (org.eclipse.aether.graph.Dependency dep : request.getDependencies()) {
return enhanceDependencies(...)

} catch (DependencyCollectionException e) {
throw new DependencyResolverException("Unable to collect dependencies", e);
String enhancedMessage = enhanceCollectionError(e, collectRequest);
throw new DependencyResolverException(enhancedMessage, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new DependencyResolverException(enhancedMessage, e);
throw new DependencyResolverException(enhanceCollectionError(e, collectRequest), e);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as is

} catch (DependencyCollectionException e) {
throw new DependencyResolverException("Unable to collect dependencies", e);
String enhancedMessage = enhanceCollectionError(e, collectRequest);
throw new DependencyResolverException(enhancedMessage, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as is

enhanced.append("Failed to collect dependencies");

org.eclipse.aether.graph.Dependency root = request.getRoot();
if (root != null && root.getArtifact() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ternary operators are harder to read

Adjust if statement formatting to comply with project code style:
- Split OR conditions onto separate lines with proper indentation
- Ensures consistency with Spotless formatting rules
@GaoSSR GaoSSR force-pushed the fix/improve-error-message-issue-10324 branch from 5867ad5 to 1bafff2 Compare January 13, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MNG-8751] Bad error message when unresolved expressions exist in POM

3 participants